Record Search Feedback
curl --request POST \
--url https://api.sophra.org/api/cortex/feedback \
--header 'Content-Type: application/json' \
--data '
{
"sessionId": "sess_abc123",
"feedback": [
{
"queryId": "q_xyz789",
"rating": 0.8,
"metadata": {
"userAction": "click",
"timestamp": "2024-03-25T10:30:00Z",
"resultId": "res_456def",
"queryHash": "hash123",
"engagementType": "direct",
"customMetadata": {
"searchType": "hybrid",
"position": 3,
"timeToClick": 2500,
"deviceType": "desktop",
"viewport": {
"width": 1920,
"height": 1080
},
"scrollDepth": 0.75,
"dwellTime": 45000,
"category": "documentation",
"language": "en"
}
}
}
]
}
'import requests
url = "https://api.sophra.org/api/cortex/feedback"
payload = {
"sessionId": "sess_abc123",
"feedback": [
{
"queryId": "q_xyz789",
"rating": 0.8,
"metadata": {
"userAction": "click",
"timestamp": "2024-03-25T10:30:00Z",
"resultId": "res_456def",
"queryHash": "hash123",
"engagementType": "direct",
"customMetadata": {
"searchType": "hybrid",
"position": 3,
"timeToClick": 2500,
"deviceType": "desktop",
"viewport": {
"width": 1920,
"height": 1080
},
"scrollDepth": 0.75,
"dwellTime": 45000,
"category": "documentation",
"language": "en"
}
}
}
]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
sessionId: 'sess_abc123',
feedback: [
{
queryId: 'q_xyz789',
rating: 0.8,
metadata: {
userAction: 'click',
timestamp: '2024-03-25T10:30:00Z',
resultId: 'res_456def',
queryHash: 'hash123',
engagementType: 'direct',
customMetadata: {
searchType: 'hybrid',
position: 3,
timeToClick: 2500,
deviceType: 'desktop',
viewport: {width: 1920, height: 1080},
scrollDepth: 0.75,
dwellTime: 45000,
category: 'documentation',
language: 'en'
}
}
}
]
})
};
fetch('https://api.sophra.org/api/cortex/feedback', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sophra.org/api/cortex/feedback",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'sessionId' => 'sess_abc123',
'feedback' => [
[
'queryId' => 'q_xyz789',
'rating' => 0.8,
'metadata' => [
'userAction' => 'click',
'timestamp' => '2024-03-25T10:30:00Z',
'resultId' => 'res_456def',
'queryHash' => 'hash123',
'engagementType' => 'direct',
'customMetadata' => [
'searchType' => 'hybrid',
'position' => 3,
'timeToClick' => 2500,
'deviceType' => 'desktop',
'viewport' => [
'width' => 1920,
'height' => 1080
],
'scrollDepth' => 0.75,
'dwellTime' => 45000,
'category' => 'documentation',
'language' => 'en'
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sophra.org/api/cortex/feedback"
payload := strings.NewReader("{\n \"sessionId\": \"sess_abc123\",\n \"feedback\": [\n {\n \"queryId\": \"q_xyz789\",\n \"rating\": 0.8,\n \"metadata\": {\n \"userAction\": \"click\",\n \"timestamp\": \"2024-03-25T10:30:00Z\",\n \"resultId\": \"res_456def\",\n \"queryHash\": \"hash123\",\n \"engagementType\": \"direct\",\n \"customMetadata\": {\n \"searchType\": \"hybrid\",\n \"position\": 3,\n \"timeToClick\": 2500,\n \"deviceType\": \"desktop\",\n \"viewport\": {\n \"width\": 1920,\n \"height\": 1080\n },\n \"scrollDepth\": 0.75,\n \"dwellTime\": 45000,\n \"category\": \"documentation\",\n \"language\": \"en\"\n }\n }\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sophra.org/api/cortex/feedback")
.header("Content-Type", "application/json")
.body("{\n \"sessionId\": \"sess_abc123\",\n \"feedback\": [\n {\n \"queryId\": \"q_xyz789\",\n \"rating\": 0.8,\n \"metadata\": {\n \"userAction\": \"click\",\n \"timestamp\": \"2024-03-25T10:30:00Z\",\n \"resultId\": \"res_456def\",\n \"queryHash\": \"hash123\",\n \"engagementType\": \"direct\",\n \"customMetadata\": {\n \"searchType\": \"hybrid\",\n \"position\": 3,\n \"timeToClick\": 2500,\n \"deviceType\": \"desktop\",\n \"viewport\": {\n \"width\": 1920,\n \"height\": 1080\n },\n \"scrollDepth\": 0.75,\n \"dwellTime\": 45000,\n \"category\": \"documentation\",\n \"language\": \"en\"\n }\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sophra.org/api/cortex/feedback")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"sessionId\": \"sess_abc123\",\n \"feedback\": [\n {\n \"queryId\": \"q_xyz789\",\n \"rating\": 0.8,\n \"metadata\": {\n \"userAction\": \"click\",\n \"timestamp\": \"2024-03-25T10:30:00Z\",\n \"resultId\": \"res_456def\",\n \"queryHash\": \"hash123\",\n \"engagementType\": \"direct\",\n \"customMetadata\": {\n \"searchType\": \"hybrid\",\n \"position\": 3,\n \"timeToClick\": 2500,\n \"deviceType\": \"desktop\",\n \"viewport\": {\n \"width\": 1920,\n \"height\": 1080\n },\n \"scrollDepth\": 0.75,\n \"dwellTime\": 45000,\n \"category\": \"documentation\",\n \"language\": \"en\"\n }\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"feedbackId": "<string>",
"processed": true,
"timestamp": "2023-11-07T05:31:56Z"
}
}Cortex > Feedback
Record Search Feedback
POST
/
cortex
/
feedback
Record Search Feedback
curl --request POST \
--url https://api.sophra.org/api/cortex/feedback \
--header 'Content-Type: application/json' \
--data '
{
"sessionId": "sess_abc123",
"feedback": [
{
"queryId": "q_xyz789",
"rating": 0.8,
"metadata": {
"userAction": "click",
"timestamp": "2024-03-25T10:30:00Z",
"resultId": "res_456def",
"queryHash": "hash123",
"engagementType": "direct",
"customMetadata": {
"searchType": "hybrid",
"position": 3,
"timeToClick": 2500,
"deviceType": "desktop",
"viewport": {
"width": 1920,
"height": 1080
},
"scrollDepth": 0.75,
"dwellTime": 45000,
"category": "documentation",
"language": "en"
}
}
}
]
}
'import requests
url = "https://api.sophra.org/api/cortex/feedback"
payload = {
"sessionId": "sess_abc123",
"feedback": [
{
"queryId": "q_xyz789",
"rating": 0.8,
"metadata": {
"userAction": "click",
"timestamp": "2024-03-25T10:30:00Z",
"resultId": "res_456def",
"queryHash": "hash123",
"engagementType": "direct",
"customMetadata": {
"searchType": "hybrid",
"position": 3,
"timeToClick": 2500,
"deviceType": "desktop",
"viewport": {
"width": 1920,
"height": 1080
},
"scrollDepth": 0.75,
"dwellTime": 45000,
"category": "documentation",
"language": "en"
}
}
}
]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
sessionId: 'sess_abc123',
feedback: [
{
queryId: 'q_xyz789',
rating: 0.8,
metadata: {
userAction: 'click',
timestamp: '2024-03-25T10:30:00Z',
resultId: 'res_456def',
queryHash: 'hash123',
engagementType: 'direct',
customMetadata: {
searchType: 'hybrid',
position: 3,
timeToClick: 2500,
deviceType: 'desktop',
viewport: {width: 1920, height: 1080},
scrollDepth: 0.75,
dwellTime: 45000,
category: 'documentation',
language: 'en'
}
}
}
]
})
};
fetch('https://api.sophra.org/api/cortex/feedback', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sophra.org/api/cortex/feedback",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'sessionId' => 'sess_abc123',
'feedback' => [
[
'queryId' => 'q_xyz789',
'rating' => 0.8,
'metadata' => [
'userAction' => 'click',
'timestamp' => '2024-03-25T10:30:00Z',
'resultId' => 'res_456def',
'queryHash' => 'hash123',
'engagementType' => 'direct',
'customMetadata' => [
'searchType' => 'hybrid',
'position' => 3,
'timeToClick' => 2500,
'deviceType' => 'desktop',
'viewport' => [
'width' => 1920,
'height' => 1080
],
'scrollDepth' => 0.75,
'dwellTime' => 45000,
'category' => 'documentation',
'language' => 'en'
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sophra.org/api/cortex/feedback"
payload := strings.NewReader("{\n \"sessionId\": \"sess_abc123\",\n \"feedback\": [\n {\n \"queryId\": \"q_xyz789\",\n \"rating\": 0.8,\n \"metadata\": {\n \"userAction\": \"click\",\n \"timestamp\": \"2024-03-25T10:30:00Z\",\n \"resultId\": \"res_456def\",\n \"queryHash\": \"hash123\",\n \"engagementType\": \"direct\",\n \"customMetadata\": {\n \"searchType\": \"hybrid\",\n \"position\": 3,\n \"timeToClick\": 2500,\n \"deviceType\": \"desktop\",\n \"viewport\": {\n \"width\": 1920,\n \"height\": 1080\n },\n \"scrollDepth\": 0.75,\n \"dwellTime\": 45000,\n \"category\": \"documentation\",\n \"language\": \"en\"\n }\n }\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sophra.org/api/cortex/feedback")
.header("Content-Type", "application/json")
.body("{\n \"sessionId\": \"sess_abc123\",\n \"feedback\": [\n {\n \"queryId\": \"q_xyz789\",\n \"rating\": 0.8,\n \"metadata\": {\n \"userAction\": \"click\",\n \"timestamp\": \"2024-03-25T10:30:00Z\",\n \"resultId\": \"res_456def\",\n \"queryHash\": \"hash123\",\n \"engagementType\": \"direct\",\n \"customMetadata\": {\n \"searchType\": \"hybrid\",\n \"position\": 3,\n \"timeToClick\": 2500,\n \"deviceType\": \"desktop\",\n \"viewport\": {\n \"width\": 1920,\n \"height\": 1080\n },\n \"scrollDepth\": 0.75,\n \"dwellTime\": 45000,\n \"category\": \"documentation\",\n \"language\": \"en\"\n }\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sophra.org/api/cortex/feedback")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"sessionId\": \"sess_abc123\",\n \"feedback\": [\n {\n \"queryId\": \"q_xyz789\",\n \"rating\": 0.8,\n \"metadata\": {\n \"userAction\": \"click\",\n \"timestamp\": \"2024-03-25T10:30:00Z\",\n \"resultId\": \"res_456def\",\n \"queryHash\": \"hash123\",\n \"engagementType\": \"direct\",\n \"customMetadata\": {\n \"searchType\": \"hybrid\",\n \"position\": 3,\n \"timeToClick\": 2500,\n \"deviceType\": \"desktop\",\n \"viewport\": {\n \"width\": 1920,\n \"height\": 1080\n },\n \"scrollDepth\": 0.75,\n \"dwellTime\": 45000,\n \"category\": \"documentation\",\n \"language\": \"en\"\n }\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"feedbackId": "<string>",
"processed": true,
"timestamp": "2023-11-07T05:31:56Z"
}
}
